<!DOCTYPE html>
<html lang="en">
<head th:insert="/admin/common/head::css"></head>
<body>
<div th:insert="/admin/common/header::header" ></div>
<!--  main  -->
<div class="container-fluid">
    <div class="row-fluid">
        <div th:insert="/admin/common/side::side" ></div>
        <!-- content -->
        <div class="block">
            <div class="block-content collapse in">
                <div class="span12">
                    <form class="form-horizontal" method="post" th:action="@{/admin/user/update}">
                        <fieldset>
                            <legend>用户修改</legend>

                            <div class="control-group" th:if="${user != null}">
                                <label class="control-label" for="date01">用户id</label>
                                <div class="controls">
                                    <input readonly="readonly" required type="text" class="input-xlarge datepicker" id="id" name="id" th:value="${user!=null?user.id:''}">
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" >用户名字</label>
                                <div class="controls">
                                    <input required type="text" class="input-xlarge datepicker" id="username" name="username" th:value="${user!=null?user.username:''}">
                                </div>
                            </div>

                            <div class="control-group" th:if="${user == null}">
                                <label class="control-label" for="date01">密码</label>
                                <div class="controls">
                                    <input required type="password" class="input-xlarge datepicker" id="password" name="password" th:value="${user!=null?user.password:''}">
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" for="date01">用户号码</label>
                                <div class="controls">
                                    <input required type="text" class="input-xlarge datepicker" id="date01" name="phone" th:value="${user!=null?user.phone:''}">
                                </div>
                            </div>
                            <div class="control-group success">
                                <label class="control-label" for="selectError">用户类别</label>
                                <div class="controls">
                                    <select id="selectError" required name="userType" th:value="${user!=null? user.userType:''}">
                                        <option th:selected = "${user != null ? user.userType == 0:''}" value = "0">辅导员或院系领导</option>
                                        <option th:selected = "${user != null ? user.userType == 1:''}" value="1">高校毕业生</option>
                                    </select>
                                </div>
                            </div>


                            <!-- 专业 -->
                            <div class="control-group success">
                                <label class="control-label" for="selectError">专业类别</label>
                                <div class="controls">
                                    <select required name="mid" id="mid" class="form-control1" th:value="${user!=null? user.mid:''}">
                                        <option th:each="major:${majors}" th:selected = "${user != null ? user.mid == major.id:''}"   th:value="${major.id}" th:text="${major.name}"></option>
                                    </select>
                                </div>
                            </div>


                            <!-- 班级 -->
                            <div class="control-group success">
                                <label class="control-label" for="selectError">班级类别</label>
                                <div class="controls">
                                    <select required name="bjId" id="bjId" class="form-control1" th:value="${user!=null? user.mid:''}">
                                        <option th:each="bj:${bjs}" th:selected = "${user != null ? user.bjId == bj.id:''}"   th:value="${bj.id}" th:text="${bj.name}"></option>
                                    </select>
                                </div>
                            </div>



                            <!-- 年纪 -->
                            <div class="control-group success">
                                <label class="control-label" for="selectError">年纪类别</label>
                                <div class="controls">
                                    <select required name="gid" id="gid" class="form-control1" th:value="${user!=null? user.mid:''}">
                                        <option th:each="grade:${grades}" th:selected = "${user != null ? user.gid == grade.id:''}"   th:value="${grade.id}" th:text="${grade.name}"></option>
                                    </select>
                                </div>
                            </div>



                            <div class="form-actions">
                                <button type="submit" class="btn btn-primary"  >[[ ${user!=null?'更新':'新增'} ]]</button>
                            </div>
                        </fieldset>
                    </form>

                </div>
            </div>
        </div>
        <!-- content -->
    </div>
</div>
<!--  main  -->

</body>
<div th:insert="/admin/common/footer::js" ></div>

</html>